package com.zm.exercise.enitiy;

import java.time.LocalDate;

/**
 * @Author:Domen
 * @Date:2024/7/15 11:25
 */

public class User implements Comparable<User>{
    private String name;    //名字
    private Integer sex; //0为男，1为女
    private Integer age; //年龄
    private Integer phone; //电话号
    private String address; //地址
    private LocalDate birthday; //出生日期

    public User(String name, Integer sex, Integer age, Integer phone, String address, LocalDate birthday) {
        this.name = name;
        this.sex = sex;
        this.age = age;
        this.phone = phone;
        this.address = address;
        this.birthday = birthday;
    }

    public User(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getSex() {
        return sex;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public Integer getPhone() {
        return phone;
    }

    public void setPhone(Integer phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public LocalDate getBirthday() {
        return birthday;
    }

    public void setBirthday(LocalDate birthday) {
        this.birthday = birthday;
    }

    @Override
    public int compareTo(User o) {
        if(this.age > o.age){
            return -1;
        }
        if(this.age < o.age){
            return 1;
        }
        return 0;
    }
}
